#include <nxos.h>

void NX_TimePrint(NX_Time * time)
{
    char *weekDay[] = {
        "Sunday",
        "Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday"
    };
    
    NX_Printf("time:%d:%d:%d date:%d/%d/%d\n",
        time->hour, time->minute, time->second,
        time->year, time->month, time->day);
    NX_Printf("week day:%d %s year day:%d\n", time->weekDay, weekDay[time->weekDay], time->yearDay);
}

NX_Error TEST_Time(char *cmdline)
{
    NX_Printf("time test!\n");
    
    NX_Time time;
    NX_TimeGet(&time);
    NX_TimePrint(&time);
    time.year = 1998;
    time.month = 02;
    time.day = 04;
    time.hour = 12;
    time.minute = 24;
    time.second = 36;
    NX_TimeSet(&time);
    NX_TimeGet(&time);
    NX_TimePrint(&time);
    
    return NX_EOK;
}
